home *** CD-ROM | disk | FTP | other *** search
- /* stat.c, from page 368 of Turbo C Bible */
- #include <stdio.h>
- #include <sys\types.h>
- #include <sys\stat.h>
- #include <time.h>
- main (int argc, char **argv)
- {
- struct stat info;
- if (argc < 2)
- {
- printf ("Usage: %s <pathname>\n", argv [0]);
- }
- else
- {
- if (stat (argv [1], &info) != 0)
- {
- perror ("Error in \"stat\"");
- exit (1);
- }
- /* Print out information about the file */
- printf ("File: %s\n"
- "Drive : %c\n"
- "Size : %ld bytes, \n"
- "Last modified: %s\n", argv [1], info.st_dev+65,
- info.st_size, ctime (&info.st_atime));
- }
- }